﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StartExperiment.aspx.cs"
    Inherits="StartExperiment" %>

<%@ Register Assembly="Wisesoft.Web.Control" Namespace="Wisesoft.Web.Control" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>维护全局配置</title>
    <link rel="stylesheet" type="text/css" href="../css/master.css" />

    <script language="javascript">
    
    function GetReportName(){
        var report=document.getElementById('txtReportName');
        var SY=document.getElementById('ddlSYName');
        var compute=document.getElementById('ddlComputeID');
        var selectedComputeID="";
        var selectedSYName="";
        var reportName="";
        for(var computeIndex=0;computeIndex<compute.options.length;computeIndex++)
        {
            if(compute.options[computeIndex].selected)
                selectedComputeID =compute.options[computeIndex].value;
        }
        
        for(var JDNameindex=0;JDNameindex<SY.options.length;JDNameindex++)
        {
            if(SY.options[JDNameindex].selected)
                selectedSYName=SY.options[JDNameindex].text;
        }
        
        var myDate = new Date();
        var month=myDate.getMonth()+1;
        var day="";
        if(month<10)
            month="0"+month;
        
        if(myDate.getDate()<10)
            day="0"+myDate.getDate();
        else
            day=myDate.getDate();
        report.value="#"+selectedComputeID+selectedSYName+"-"+myDate.getFullYear()+month+day;
    }
    
    
    function check(v){ 
        var maxTime=document.getElementById('hddMaxTime').value;
        if(v.id=='txtSYTime' && parseInt(v.value)> maxTime)
        {
            alert('试验时长不能超过'+maxTime+'分钟');
            return;
        }     
        var SplitTime=document.getElementById('hddMinSplitTime').value;
        if(v.id=='txtSplitTime' && parseInt(v.value)<SplitTime)
        {
            alert('采样间隔时间不能小于'+SplitTime+'秒');
            return;
        }
    }
    
    function linkExpriment(){
        var reportid=document.getElementById('hddMaxReportID').value;
        window.open('DisplayReport.aspx?ReportID='+reportid,"_blank");
    }
    </script>

</head>
<body onload="GetReportName();">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <img src="../img/Experiment.gif" style="width: 99%; height: 38px" />
    <div style="width: 99%">
        <div class="tablediv2">
            <div class="rowdiv3">
                <table width="100%" border="0">
                    <tr>
                        <td height="5">
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div class="groupBox">
            <table width="100%" class="groupBoxCaption">
                <tr>
                    <td nowrap="noWrap">
                        启停热力实验
                    </td>
                </tr>
            </table>
            <table width="100%" class="groupBoxContainer">
                <tr>
                    <td width="34%" nowrap="noWrap">
                        <span class="groupBoxLabel2">机组</span>
                        <asp:DropDownList ID="ddlComputeID" runat="server" Width="168px" Style="margin-left: 2px"
                            onchange="GetReportName();">
                            <asp:ListItem Value="1">1号机</asp:ListItem>
                            <asp:ListItem Value="2">2号机</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td style="width: 308px" nowrap="noWrap">
                        <span class="groupBoxLabel4">实验名称</span>
                        <asp:DropDownList ID="ddlSYName" runat="server" Width="168px" Style="margin-left: 2px"
                            onchange="GetReportName();">
                        </asp:DropDownList>
                    </td>
                    <td width="33%" nowrap="noWrap">
                        <span class="groupBoxLabel4">报告名称</span>
                        <input type="text" id="txtReportName" runat="server" size="12" style="overflow: hidden;
                            width: 250px" />
                    </td>
                </tr>                
                <tr>
                </tr>
                <tr>
                    <td>
                        <span class="groupBoxLabel4">开始时间</span><cc1:CalenderBox Style="margin-left: 5px;
                            width: 162px" ID="calSYStartTime" runat="server" BackColor="White"></cc1:CalenderBox>
                    </td>
                    <td>
                        <span class="groupBoxLabel4">试验时长</span><input type="text" id="txtSYTime" runat="server"
                            onblur="check(this);" size="12" style="margin-left: 10px; overflow: hidden; width: 160px" />分
                    </td>
                    <%--<td>
                        <span class="groupBoxLabel4">结束时间</span><cc1:CalenderBox ID="calEndTime" Style="margin-left: 8px;
                            width: 250px" runat="server" BackColor="White"></cc1:CalenderBox>
                            
                    </td>--%>
                </tr>
                <tr>
                </tr>
                <tr>
                    <td>
                        <span class="groupBoxLabel4">采样间隔</span><input type="text" id="txtSplitTime" runat="server"
                            onblur="check(this);" style="width: 160px; overflow: hidden; margin-left: 5px;" />秒
                    </td>
                    <td>
                        <span class="groupBoxLabel3">试验人</span><input type="text" id="txtSYR" runat="server"
                            size="12" style="margin-left: 14px; overflow: hidden; width: 160px" />
                    </td>
                    <td>
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick">
                                </asp:Timer>
                                <asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                </tr>
            </table>
        </div>
    </div>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <div style="float: right; margin-right: 20px; margin-top: 10px">
                <input id="hddMaxReportID" type="hidden" runat="server" />
                <asp:Button ID="btnStartEnd" runat="server" Text="开始实验" OnClick="btnStartEnd_Click" />
                <asp:Button ID="btnView" runat="server" Text="查看当前实验" /></div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div>
        <input id="hddMaxTime" type="hidden" runat="server" />
        <input id="hddMinSplitTime" type="hidden" runat="server" />
    </div>
    </form>
</body>
</html>
